/* ===============================================
   材质编辑器面板样式
   左侧材质列表 + 右侧参数编辑
   =============================================== */

/* ⭐ 修复材质编辑器面板的高度自适应问题 */
/* 使用更高优先级的选择器覆盖通用样式 */
.right-panel#material-editor-panel {
    display: flex !important;
    flex-direction: column !important;
    /* ⭐ 不使用!important，允许JavaScript动态调整高度 */
    height: calc(100vh - 100px); /* 默认高度接近全屏，只留100px边距 */
    max-height: calc(100vh - 60px); /* 最大高度只留60px边距 */
    min-height: 400px; /* 最小高度 */
    /* ⭐ 不设置position，使用editor.css中的fixed定位 */
}

.right-panel#material-editor-panel .panel-header {
    flex-shrink: 0 !important;
}

.right-panel#material-editor-panel .panel-content {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    min-height: 0 !important; /* 修复flex子元素高度问题 */
    max-height: 100% !important; /* ⭐ 限制最大高度为100% */
    padding: 0 !important;
    position: relative !important; /* ⭐ 为覆盖层提供定位上下文 */
}

.right-panel#material-editor-panel .panel-body {
    flex: 1 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important; /* 修复flex子元素高度问题 */
    max-height: 100% !important; /* ⭐ 限制最大高度为100% */
    padding: 0 !important; /* ⭐ 覆盖editor.css中的padding: 6px 6px 10px 6px */
    margin: 0 !important; /* ⭐ 确保没有margin */
}

/* ⭐ 确保材质编辑器面板的拖拽手柄可用且不占用布局空间 */
.right-panel#material-editor-panel .resize-handle {
    position: absolute !important; /* 绝对定位，不占用布局空间 */
    z-index: 100; /* 确保在最上层 */
    pointer-events: auto !important; /* 确保可以点击 */
    margin: 0 !important; /* 确保没有margin */
    padding: 0 !important; /* 确保没有padding */
}

.right-panel#material-editor-panel .resize-left {
    left: 0;
    top: 0;
    width: 8px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
}

.right-panel#material-editor-panel .resize-left:hover {
    background: rgba(102, 126, 234, 0.3);
}

.right-panel#material-editor-panel .resize-bottom {
    left: 0;
    bottom: 0;
    width: 100%;
    height: 8px;
    cursor: ns-resize;
    background: transparent;
}

.right-panel#material-editor-panel .resize-bottom:hover {
    background: rgba(102, 126, 234, 0.3);
}

.right-panel#material-editor-panel .resize-corner {
    left: 0;
    bottom: 0;
    width: 20px;
    height: 20px;
    cursor: nesw-resize;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 0 16px 0 0;
}

.right-panel#material-editor-panel .resize-corner:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* 主布局 - 修复高度自适应 */
.material-editor-layout {
    display: flex;
    flex: 1; /* ⭐ 使用flex而不是height: 100% */
    max-height: 100%; /* ⭐ 限制最大高度为100% */
    min-height: 0; /* ⭐ 允许缩小 */
    gap: 0;
    background: rgba(20, 20, 25, 0.95);
    overflow: hidden; /* 防止溢出 */
}

/* ===============================================
   左侧：材质列表
   =============================================== */

.material-list-section {
    width: 280px;
    min-width: 280px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    background: rgba(30, 30, 35, 0.98);
    border-right: 1px solid rgba(102, 126, 234, 0.2);
    flex: 0 0 auto; /* ⭐ 不拉伸，保持固定宽度 */
    max-height: 100%; /* ⭐ 限制最大高度 */
    min-height: 0; /* ⭐ 修复flex子元素高度问题 */
    align-self: stretch; /* ⭐ 垂直拉伸填满父容器 */
}

/* 顶部新建材质按钮 */
.btn-new-material-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
    border: 1px solid rgba(102, 126, 234, 0.5);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 8px;
}

.btn-new-material-header:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.4), rgba(118, 75, 162, 0.4));
    border-color: rgba(102, 126, 234, 0.7);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-new-material-header:active {
    transform: translateY(0);
}

.btn-new-material-header span:first-child {
    font-size: 14px;
    line-height: 1;
}

/* 搜索框 */
.material-search-box {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.material-search-box input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    transition: all 0.2s ease;
}

.material-search-box input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.6);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.material-search-box input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* 筛选框 */
.material-filter-box {
    padding: 8px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.material-filter-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

.material-filter-checkbox:hover {
    color: rgba(255, 255, 255, 0.95);
}

.material-filter-checkbox input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

.material-filter-checkbox span {
    flex: 1;
}

/* 材质列表滚动容器 - 修复高度自适应 */
.material-list-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    max-height: none; /* ⭐ 移除max-height限制，跟随面板高度 */
    min-height: 0; /* 修复flex子元素高度问题 */
}

.material-list-scroll::-webkit-scrollbar {
    width: 8px;
}

.material-list-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.material-list-scroll::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.4);
    border-radius: 4px;
}

.material-list-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.6);
}

/* 材质列表项 */
.material-list-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.material-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: default;
    transition: all 0.2s ease;
}

/* 移除材质列表项的hover效果 */
/* .material-list-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateX(3px);
} */

.material-list-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border-color: rgba(102, 126, 234, 0.6);
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.25);
}

.material-item-info {
    flex: 1;
    min-width: 0;
}

.material-item-name-container {
    margin-bottom: 4px;
}

.material-item-name-display {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

/* 移除材质名称的hover效果 */
/* .material-item-name-display:hover {
    background: rgba(102, 126, 234, 0.15);
} */

.material-item-name-input {
    width: 100%;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(102, 126, 234, 0.6);
    border-radius: 3px;
    padding: 2px 4px;
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.material-item-name-input:focus {
    border-color: rgba(102, 126, 234, 0.8);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.material-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.material-type-tag {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 3px;
    color: rgba(102, 126, 234, 1);
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.material-usage-tag {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 3px;
    color: rgba(76, 175, 80, 1);
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.material-usage-tag:empty {
    display: none;
}

/* 空状态 */
.material-list-empty {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.4);
}

.material-list-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.material-list-empty .empty-text {
    font-size: 14px;
    margin-bottom: 5px;
}

/* ===============================================
   右侧：参数编辑区域
   =============================================== */

.material-params-section {
    flex: 1; /* 占据剩余空间 */
    display: flex;
    flex-direction: column;
    background: rgba(25, 25, 30, 0.98);
    overflow: hidden;
    max-height: 100%; /* ⭐ 限制最大高度为100% */
    min-height: 0; /* ⭐ 修复flex子元素高度问题 */
    align-self: stretch; /* ⭐ 垂直拉伸填满父容器 */
}

.material-params-content {
    flex: 1; /* 占据所有可用空间 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 100%; /* ⭐ 限制最大高度为100% */
    min-height: 0; /* ⭐ 修复flex子元素高度问题 */
}

/* 参数头部 - 单行布局 */
.material-params-header {
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    flex-shrink: 0;
}

.material-params-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.material-unsaved-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.material-unsaved-text {
    font-size: 12px;
    color: rgba(255, 107, 107, 0.95);
    font-weight: 500;
}

.material-params-actions-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.material-unsaved-indicator {
    color: #ff6b6b;
    font-size: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.material-params-actions {
    display: flex;
    gap: 8px;
}

.btn-material-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-material-action span {
    line-height: 1;
}

.btn-material-action:hover {
    background: rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateY(-1px);
}

.btn-material-action.danger {
    background: rgba(255, 107, 107, 0.15);
    border-color: rgba(255, 107, 107, 0.3);
    color: rgba(255, 107, 107, 0.95);
}

.btn-material-action.danger:hover {
    background: rgba(255, 107, 107, 0.25);
    border-color: rgba(255, 107, 107, 0.5);
}

.btn-material-action.apply {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(56, 142, 60, 0.2));
    border-color: rgba(76, 175, 80, 0.4);
    color: rgba(129, 199, 132, 0.95);
    font-weight: 600;
}

.btn-material-action.apply:hover {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.3), rgba(56, 142, 60, 0.3));
    border-color: rgba(76, 175, 80, 0.6);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.btn-material-action.save {
    background: linear-gradient(135deg, rgba(66, 165, 245, 0.2), rgba(33, 150, 243, 0.2));
    border-color: rgba(66, 165, 245, 0.4);
    color: rgba(144, 202, 249, 0.95);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-material-action.save:hover {
    background: linear-gradient(135deg, rgba(66, 165, 245, 0.3), rgba(33, 150, 243, 0.3));
    border-color: rgba(66, 165, 245, 0.6);
    box-shadow: 0 2px 8px rgba(66, 165, 245, 0.3);
}

.btn-material-action.preview {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.2), rgba(123, 31, 162, 0.2));
    border-color: rgba(156, 39, 176, 0.4);
    color: rgba(206, 147, 216, 0.95);
    font-weight: 600;
}

.btn-material-action.preview:hover {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.3), rgba(123, 31, 162, 0.3));
    border-color: rgba(156, 39, 176, 0.6);
    box-shadow: 0 2px 8px rgba(156, 39, 176, 0.3);
}

.material-btn-danger {
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.2), rgba(211, 47, 47, 0.2));
    border: 1px solid rgba(244, 67, 54, 0.4);
    border-radius: 6px;
    color: rgba(255, 138, 128, 0.95);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.material-btn-danger:hover {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.3), rgba(211, 47, 47, 0.3));
    border-color: rgba(244, 67, 54, 0.6);
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}

.warning-text {
    color: #ff9800;
    font-weight: 500;
    margin-top: 10px;
}

/* 参数滚动区域 - 修复高度自适应 */
.material-params-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 14px;
    max-height: none; /* ⭐ 移除max-height限制，跟随面板高度 */
    min-height: 0; /* 确保flex子元素能正确缩小 */
}

.material-params-scroll::-webkit-scrollbar {
    width: 8px;
}

.material-params-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
}

.material-params-scroll::-webkit-scrollbar-thumb {
    background: rgba(108, 204, 153, 0.3);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.material-params-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(108, 204, 153, 0.5);
}

/* 参数组 - 超紧凑模式 */
.material-param-group {
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 10px 12px;
}

.param-group-title {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
    padding: 5px 8px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s ease;
    border-radius: 3px;
}

.param-group-title:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.param-group-icon {
    font-size: 10px;
    transition: transform 0.2s ease;
    display: inline-block;
    width: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.param-group-content {
    max-height: 5000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

.param-group-content.collapsed {
    max-height: 0 !important;
    opacity: 0;
    transition: max-height 0.3s ease-in, opacity 0.3s ease-in;
}

/* 参数项 - 超紧凑模式 */
.param-item {
    margin-bottom: 8px;
}

.param-item:last-child {
    margin-bottom: 0;
}

.param-item label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 4px;
    padding-left: 2px;
}

/* 参数输入行 */
.param-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.param-input-row input[type="color"] {
    width: 40px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px;
}

.param-input-row input[type="range"] {
    flex: 1;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.param-input-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s;
}

.param-input-row input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.param-input-hex {
    width: 90px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    font-family: 'Courier New', monospace;
    text-align: center;
}

.param-input-hex:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.6);
    background: rgba(102, 126, 234, 0.08);
}

.param-input-number {
    width: 60px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    text-align: center;
}

.param-input-number:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.6);
    background: rgba(102, 126, 234, 0.08);
}

/* 纹理输入行 */
.param-texture-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.param-input-texture {
    flex: 1;
    padding: 9px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    font-family: 'Courier New', monospace;
}

.param-input-texture:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.6);
    background: rgba(102, 126, 234, 0.08);
}

.btn-select-texture {
    padding: 9px 16px;
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-select-texture:hover {
    background: rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.5);
}

.btn-clear-texture {
    width: 36px;
    height: 36px;
    padding: 0;
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 6px;
    color: rgba(255, 107, 107, 0.95);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-clear-texture:hover {
    background: rgba(255, 107, 107, 0.25);
    border-color: rgba(255, 107, 107, 0.5);
    transform: scale(1.05);
}

/* 复选框 */
.param-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.param-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: rgba(102, 126, 234, 1);
}

.param-checkbox-label span {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

/* ===============================================
   材质预览浮动窗口
   =============================================== */

/* 预览浮动窗口容器 */
.material-preview-float-window {
    position: fixed;
    top: 100px;
    right: 320px;
    width: 400px;
    height: 400px;
    background: rgba(25, 25, 30, 0.98);
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: none; /* 默认隐藏 */
    flex-direction: column;
    backdrop-filter: blur(10px);
    animation: fadeInFloat 0.3s ease;
}

.material-preview-float-window.visible {
    display: flex;
}

@keyframes fadeInFloat {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 预览窗口头部 */
.preview-float-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border-bottom: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px 12px 0 0;
    cursor: move; /* 可拖动 */
    user-select: none;
}

.preview-float-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-float-actions {
    display: flex;
    gap: 8px;
}

.preview-float-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preview-float-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(102, 126, 234, 0.6);
    color: rgba(255, 255, 255, 1);
}

.preview-float-btn.close:hover {
    background: rgba(244, 67, 54, 0.3);
    border-color: rgba(244, 67, 54, 0.6);
    color: rgba(255, 138, 128, 1);
}

/* 预览窗口内容区 */
.preview-float-content {
    flex: 1;
    position: relative;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    overflow: hidden;
}

.material-preview-canvas-float {
    width: 100%;
    height: 100%;
}

.material-preview-canvas-float canvas {
    width: 100% !important;
    height: 100% !important;
}

.btn-reset-camera {
    position: absolute;
    bottom: 12px;
    right: 12px;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.btn-reset-camera:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(102, 126, 234, 0.6);
    transform: translateY(-1px);
}

/* 保存按钮 */
.material-params-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-save-material {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.3), rgba(56, 142, 60, 0.3));
    border: 1px solid rgba(76, 175, 80, 0.5);
    border-radius: 8px;
    color: #81c784;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-save-material:hover {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.4), rgba(56, 142, 60, 0.4));
    border-color: rgba(76, 175, 80, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3);
}

.btn-save-material:active {
    transform: translateY(0);
}

/* 空状态（右侧） */
.material-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 60px 40px;
    text-align: center;
}

.material-empty-state .empty-icon {
    font-size: 72px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.material-empty-state .empty-text {
    font-size: 18px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
}

.material-empty-state .empty-hint {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
}

/* ===============================================
   响应式调整
   =============================================== */

@media (max-width: 1200px) {
    .material-list-section {
        width: 240px;
        min-width: 240px;
    }
}

@media (max-width: 900px) {
    .material-editor-layout {
        flex-direction: column;
    }
    
    .material-list-section {
        width: 100%;
        max-width: none;
        min-height: 200px;
        max-height: 300px;
    }
}

/* ===============================================
   动画效果
   =============================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.material-list-item,
.material-param-group {
    animation: fadeIn 0.3s ease;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

/* ===============================================
   材质使用情况模态框
   =============================================== */

/* ⭐ 覆盖层容器（在材质编辑器面板的panel-content内显示） */
#material-editor-panel .panel-content > .material-usage-overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    display: none; /* 默认隐藏 */
    padding: 20px;
    box-sizing: border-box;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ⭐ 使用情况面板 */
.material-usage-panel {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, rgba(30, 30, 35, 0.98), rgba(25, 25, 30, 0.98));
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ⭐ 面板头部 */
.usage-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(102, 126, 234, 0.08);
}

.usage-panel-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

/* ⭐ 关闭按钮 */
.usage-panel-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.usage-panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

/* ⭐ 面板内容 */
.usage-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.usage-panel-content::-webkit-scrollbar {
    width: 10px;
}

.usage-panel-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

.usage-panel-content::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.4);
    border-radius: 5px;
}

.usage-panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.6);
}

.usage-summary {
    margin-bottom: 20px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
}

.usage-material-name {
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 8px;
}

.usage-stats {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.usage-stats strong {
    color: rgba(76, 175, 80, 1);
    font-size: 16px;
}

.usage-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.usage-scene {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 14px;
}

.usage-scene-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.usage-scene-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.usage-scene-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usage-scene-name {
    font-size: 14px;
    font-weight: 600;
    color: rgba(102, 126, 234, 1);
}

.current-scene-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.4);
    border-radius: 3px;
    color: rgba(76, 175, 80, 1);
}

.btn-show-in-search {
    padding: 6px 12px;
    font-size: 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
    border: 1px solid rgba(102, 126, 234, 0.5);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-show-in-search:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.4), rgba(118, 75, 162, 0.4));
    border-color: rgba(102, 126, 234, 0.7);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.usage-node {
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
}

.usage-node:last-child {
    margin-bottom: 0;
}

.usage-node-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.usage-node-icon {
    font-size: 16px;
}

.usage-node-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.usage-node-count {
    font-size: 11px;
    padding: 3px 8px;
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 4px;
    color: rgba(76, 175, 80, 1);
}

.usage-meshes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 24px;
}

.usage-mesh-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}

.usage-mesh-icon {
    font-size: 12px;
}

.usage-mesh-name {
    flex: 1;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
}

.usage-mesh-uuid {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Courier New', monospace;
}

/* 使用情况按钮样式 */
.btn-material-action.info {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.3), rgba(30, 136, 229, 0.3));
    border: 1px solid rgba(33, 150, 243, 0.5);
}

.btn-material-action.info:hover {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.4), rgba(30, 136, 229, 0.4));
    border-color: rgba(33, 150, 243, 0.7);
}

